import React from 'react'
import ReactDOM from 'react-dom'

var LikeButton = React.createClass({
    getInitialState: function () {
        return {
            liked: false
        }
    },
    handleClick: function (event) {
        this.setState({
            liked: !this.state.liked
        })
    },
    render: function () {
        var text = this.state.liked ? '喜欢' : '不喜欢';
        return (
            <p onClick={this.handleClick}>
                你<b>{text}</b>我
            </p>
        )
    }
})

ReactDOM.render(
    <LikeButton/>,
    document.getElementById('app')
)